import { E_TimeConfig } from "../defs/com/E_TimeConfig";
import { CDHangUp } from "../excel/CDHangUp";


/**
 * 扩展-挂机奖励
 */
export abstract class CEHandUp {
    /**比例基数 */
    public static readonly RATIO_BASE = 100000;
    /**最小间隔 */
    public static miniUpdateDuraction = E_TimeConfig.Minute;



    /**初始化 */
    public static init(): void {

        const vs = CDHangUp.datas.getValues();
        let m = E_TimeConfig.Minute;

        for (let i = vs.length - 1; i >= 0; i--) {
            const ts = vs[i].dropTime;
            if (0 === ts.length) {
                continue;
            }
            const t = ts[ts.length - 1];
            const v = Math.floor(this.RATIO_BASE / t * E_TimeConfig.Second);
            if (v < m) {
                m = v;
            }
        }

        const refresh = E_TimeConfig.Second * 10;
        this.miniUpdateDuraction = m > refresh ? m : refresh;
    }
}